@import '~bootstrap/scss/_functions';
@import '~bootstrap/scss/_variables';
@import "../../base/scss/variables.scss";
@import '~bootstrap/scss/mixins/_breakpoints';

$block-columns: 12;

@mixin block-width($block-width) {
    width: round(percentage($block-width / $block-columns));
}

.block {
    margin-bottom: 30px;
    display: inline-block;
    width: 100%;
    position: absolute;
    padding: 0 15px;

    &.width-small {
        @include media-breakpoint-up(sm) {
            @include block-width(6);
        }

        @include media-breakpoint-up(md) {
            @include block-width(3);
        }
    }

    &.width-medium {
        @include block-width(12);

        @include media-breakpoint-up(sm) {
            @include block-width(6);
        }
    }

    &.width-large {
        @include block-width(12);

        @include media-breakpoint-up(md) {
            @include block-width(9);
        }
    }

    &.width-full {
        @include block-width(12);
    }

    .block-settings {
        position: absolute;
        top: 13px;
        right: 25px;

        &.open {
            .toggle-settings {
                color: $primary;
            }
        }

        .toggle-settings {
            background: none;
            border: none;
            padding: 3px 7px;
            color: $gray-light;

            &:hover {
                color: $primary;
            }

            i {
                vertical-align: middle;
                text-align: center;
            }
        }

        .dropdown-menu {
            left: auto;
            right: 0;
            border-radius: 0;
            border: 0;
            background: $primary;
            font-size: 0.85em;
            box-shadow: 1px 2px 2px 1px rgba(0, 0, 0, 0.2);

            &:after {
                content: "";
                border-left: 6px solid transparent;
                border-right: 6px solid transparent;
                border-bottom: 6px solid $primary;
                position: absolute;
                top: -6px;
                right: 7px;
            }

            li {
                padding: 0px 10px;

                i {
                    width: 20px;
                    text-align: left;
                }

                a {
                    color: #fff;
                    padding: 3px 0px;

                    &:hover,
                    &:focus,
                    &:active {
                        background: none;
                        text-decoration: underline;
                    }
                }
            }
        }

    }

    .block-inner {
        padding: 0px;
        background-color: $white;
        border-radius: 4px;
        box-shadow: $shadow-md;

        .block-title {
            border-bottom: 2px solid $primary;
            margin-bottom: 5px;
            padding-bottom: 5px;
            margin-top: 0px;
            padding-top: 0;
            font-size: 1.6rem;

            i {
                margin-right: 10px;
                color: $primary;
            }
        }

         .block-header {
            width: 100%;
            color: #fff;
            overflow: hidden;

            .text-wrap {
                background-color: #fff;
                margin: 0;
                color: $text-color;
                vertical-align: middle;
                padding: 0.5em 1em;
                font-size: 1.1rem;
                font-weight: 500;
                text-transform: uppercase;
                padding-bottom: 0.2em;
                background-color: gainsboro;
            }

            .icon-wrap {
                display:none;
                background: darken($primary, 8%);
                height: 2rem;
                width: 2rem;
                vertical-align: middle;
                text-align: center;

                i {
                    font-size: 2.5rem;
                    color: rgba(255, 255, 255, 0.85);
                }
            }
        }

        .block-content {
            padding: 1rem;
            background-color:#fff;

            h2 {
                margin: 0;
                font-weight: 400;
            }

            .subtitle {
                color: #999;
                padding-top: 1em;
                border-top: 1px solid #DDD;
                display: block;
                margin-top: 10px;
                font-size: 0.8rem;
            }
        }

        .activity-list,
        .notifications {
            .timestamp {
                padding-left: 10px;
                font-size: 0.9em;
                color: $gray-light;
                text-align: right;
            }

            table {
                width: 100%;
                padding-bottom: 10px;

                td {
                    padding-bottom: 2px;

                    &.dismiss-td {
                        width: 1px;
                        padding-right: 1em;
                    }
                }
            }

            ul {
                list-style: none;
                padding: 0;

                li {
                    display: table;
                    width: 100%;
                    border-bottom: 1px solid #ddd;
                    padding: 10px 5px;

                    &:last-child {
                        border: 0;
                    }
                }

                .timestamp {
                    display: table-cell;
                }

                .activity-name {
                    padding-right: 10px;
                    text-align: left;
                    display: table-cell;
                }
            }

            .dismiss-button {
                background: $success;
                color: #fff;
                padding: 1px 3px;
            }
        }
    }

    // Mixin for changing block header background colors
    @mixin block-bg-color($color) {
        .block-header {
            border-bottom: 2.5px solid $color;
        }
    }

    .block-blue {
        @include block-bg-color($block-blue);
    }
    .block-orange {
        @include block-bg-color($block-orange);
    }
    .block-gray {
        @include block-bg-color($block-gray);
    }
    .block-red {
        @include block-bg-color($block-red);
    }
    .block-purple {
        @include block-bg-color($block-purple);
    }
    .block-green {
        @include block-bg-color($block-green);
    }
    .block-yellow {
        @include block-bg-color($block-yellow);
    }
    .block-navy {
        @include block-bg-color($block-navy);
    }
}

